<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" xml:lang="pt" lang="pt-br">

<f:view contentType="text/html">
	<h:head>
		<f:facet name="first">
			<meta http-equiv="X-UA-Compatible" content="EmulateIE8" />
			<meta content='text/html; charset=UTF-8' http-equiv="Content-Type" />
			<title>#{msg.titulo_home}</title>
		</f:facet>
		<h:outputStylesheet name="css/default.css" />
		<h:outputStylesheet name="css/estilo.css" />
	</h:head>
	<h:body>

		<p:layout fullPage="true">

			<p:layoutUnit id="bottom" position="south" size="30">
				<ui:include src="../rodape.xhtml" />
			</p:layoutUnit>

			<p:layoutUnit id="center" position="center" >

				<div id="menu">
					<ui:include src="../menu.xhtml" />
				</div>

				<div id="corpo">
					<h:form>
						
						<p:dataTable id="reservados" var="lista"
							value="#{solicitacaoManager.listaSolicitacaoDoDia}"
							style="float:right; padding: 5px; max-width: 530px; min-width:500px;" paginator="true" 
							rows="10"
							paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
							rowsPerPageTemplate="5,10,15"
							emptyMessage="Nenhum registro encontrado.">
							<f:facet name="header">  
						           Reservas para o dia
						    </f:facet>
		
							<p:column>
								<f:facet name="header">
									<h:outputText value="Qtd. Alunos" />
								</f:facet>
								<h:outputText value="#{lista.solicitacao.nrAlunos}" />
							</p:column>
							
							<p:column>
								<f:facet name="header">
									<h:outputText value="Sala" />
								</f:facet>
								<h:outputText value="#{lista.sala.nome}" />
							</p:column>
		
							<p:column>
								<f:facet name="header">
									<h:outputText value="Data" />
								</f:facet>
								<h:outputText value="#{lista.solicitacao.dataInicial}">
									<f:convertDateTime pattern="dd/MM/yyyy" />
								</h:outputText>
							</p:column>
		
							<p:column>
								<f:facet name="header">
									<h:outputText value="hora inicial" />
								</f:facet>
								<h:outputText value="#{lista.dataInicial}" >
									<f:convertDateTime pattern="HH:mm" timeZone="GMT-03:00" />
								</h:outputText>
							</p:column>
							
							<p:column>
								<f:facet name="header">
									<h:outputText value="hora final" />
								</f:facet>
								<h:outputText value="#{lista.dataFinal}" >
									<f:convertDateTime pattern="HH:mm" timeZone="GMT-03:00" />
								</h:outputText>
							</p:column>
		
						</p:dataTable>
						
						<p:dataTable var="lista" paginator="true" rows="10" 
							paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
							rowsPerPageTemplate="5,10,15"
							style="float:left; padding: 5px;"
							value="#{solicitacaoManager.listaSolicitacaoPendente}"
							emptyMessage="Nenhum registro encontrado.">

							<f:facet name="header">
								Lista de solicitações de reservas
							</f:facet>

							<p:column headerText="Professor">
								<h:outputText value="#{lista.professor.nome}" />
							</p:column>

							<p:column headerText="Reservar">
								<h:outputText value="#{lista.tipoSala}" />
							</p:column>

							<p:column headerText="Capacidade para">
								<h:outputText value="#{lista.nrAlunos} alunos" />
							</p:column>

							<p:column headerText="Dia da Solicitação">
								<h:outputText value="#{lista.data}">
									<f:convertDateTime pattern="dd/MM/yyyy" />
								</h:outputText>
							</p:column>

							<p:column style="width:4%">
								<p:commandButton id="verificaReserva" ajax="false"
									action="#{reservaManager.pegaSolicitacao(lista)}"
									value="Reservar" />
							</p:column>

						</p:dataTable>
				
					</h:form>
				</div>
				
				<p:messages id="mensagem" showDetail="true" autoUpdate="true"
					closable="true" redisplay="false" />
				
			</p:layoutUnit>
		</p:layout>
	</h:body>
</f:view>
</html>